import React from 'react';
import { connect } from 'dva';
import { ActivityIndicator } from 'antd-mobile';
import Register from './pages/register';

function Index({ dispatch, loading, register }) {

  const { info } = register;
  const registerProps = {
    onSave(data){
      dispatch({
        type: 'register/createAccount',
        payload: {
          data
        }
      })
    }
  }
  return (
    <div>
      <Register {...registerProps}/>
      <ActivityIndicator
        toast
        text=""
        animating={loading}
      />
    </div>
  );
}

Index.propTypes = {
};

function ribStateToProps(state, ownProps){
  return {
    loading: state.loading.global,
    register: state.register
  }
}

export default connect(ribStateToProps)(Index);
